package be.novelfaces.showcase.webdriver.tests;

import java.util.Arrays;
import java.util.Collection;

import org.junit.AfterClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.WebDriver;

import be.novelfaces.showcase.webdriver.util.Browser;
import be.novelfaces.showcase.webdriver.util.WebDriverFactory;

@RunWith(Parameterized.class)
public abstract class AbstractWebdriverTestBase {
		 
		private final WebDriver driver;
		
	    @AfterClass
	    public static void closeDrivers() {
	    	 WebDriverFactory.closeDrivers();
		    
	    }
	    
	    public AbstractWebdriverTestBase(Browser browser) {
			driver = WebDriverFactory.getInstance(browser);
		}
	    
	    @Parameters
		 public static Collection<Object[]> data() {
		   Object[][] data = new Object[][] { { Browser.FIREFOX } };
		   return Arrays.asList(data);
		 }
		 
		 protected WebDriver getWebDriver(){
			 return driver;
		 }
		 
}
